﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WoChu.RfClient.Common;

using WoChu.RfClient.Duty;

namespace WoChu.RfClient.Login
{
    public partial class FrmMain : BaseForm
    {
        public string userPsw = string.Empty;

        public FrmMain()
        {
            InitializeComponent();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            txtMain.Focus();

        }

        // 退出
        private void btnExit_Click(object sender, EventArgs e)
        {
            FrmMain_KeyDown(sender, new KeyEventArgs(Keys.Escape));
        }


        private void FrmMain_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode != Keys.Escape) return;

                this.Close();
                this.Dispose();
                Application.Exit();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnUpRack_Click(object sender, EventArgs e)
        {
            try
            {
                FrmUpRack fup = new FrmUpRack();
                fup.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnPick_Click(object sender, EventArgs e)
        {
            try
            {
                FrmPick fp = new FrmPick();
                fp.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnAdjust_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmLocationAdjustment fp = new FrmLocationAdjustment();
                fp.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btnOrderCheck_Click(object sender, EventArgs e)
        {
            try
            {
                FrmOrderCheck fa = new FrmOrderCheck();
                fa.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnOnShelves_Click(object sender, EventArgs e)
        {
            try
            {
                FrmOnShelves fa = new FrmOnShelves();
                fa.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnOffShelves_Click(object sender, EventArgs e)
        {
            try
            { 
                FrmOffShelves fa = new FrmOffShelves();
                fa.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnLocationGoods_Click(object sender, EventArgs e)
        {
            try
            {
                FrmLocationGoods fa = new FrmLocationGoods();
                fa.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnBoxOrder_Click(object sender, EventArgs e)
        {
            try
            {
                FrmBoxOrder fa = new FrmBoxOrder();
                fa.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnOffShelvesOrder_Click(object sender, EventArgs e)
        {
            try
            {
                FrmOffShelvesOrder fa = new FrmOffShelvesOrder();
                fa.Show();
                //this.Close();
                //this.Dispose();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void FrmMain_Closed(object sender, EventArgs e)
        {
            Application.Exit();
        }

        /// <summary>
        /// 损益信息事件 add by shanglin 2015-8-11
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProfitAndLoss_Click(object sender, EventArgs e)
        {
            try
            {
                FrmProfitAndLoss fp = new FrmProfitAndLoss();
                fp.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnTakeStock_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmTakeStock fp = new FrmTakeStock();
                fp.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btmInventory_Click(object sender, EventArgs e)
        {
            try
            {
                FrmGoodsInfo fp = new FrmGoodsInfo();
                fp.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnLocationGoodsMove_Click(object sender, EventArgs e)
        {
            try
            {
                FrmLocationGoodsMove flgm = new FrmLocationGoodsMove();
                flgm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
        }

        private void btnAdjusInve_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmInventoryAdjustment flgm = new FrmInventoryAdjustment();
                flgm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

 
        private void btnProdOnShelves_Click(object sender, EventArgs e)
        {

            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmProdOnShelves frm = new FrmProdOnShelves();
                frm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btnPordOnShelvesOrder_Click(object sender, EventArgs e)
        {
            
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmProdOnShelvesOrder frm = new FrmProdOnShelvesOrder();
                frm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btnBarCodeCollection_Click(object sender, EventArgs e)
        {

            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmBarCodeCollection frm = new FrmBarCodeCollection();
                frm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btnSortLocation_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmSortLocation frm = new FrmSortLocation();
                frm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btnLocationGoodsSort_Click(object sender, EventArgs e)
        {
            
                try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmLocationGoodsSort frm = new FrmLocationGoodsSort();
                frm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }

        private void btn_Click(object sender, EventArgs e)
        {
            
                try
            {
                Cursor.Current = Cursors.WaitCursor;
                FrmPickLocationReplenish frm = new FrmPickLocationReplenish();
                frm.Show();
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }  
        }   



    }
}